﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace JasLib.Interop.Win32
{
    /*
    public enum UIAutomationPatternId : int
    {
    }

    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown), ComVisible(true), Guid("d6dd68d1-86fd-4332-8666-9abedea2d24c")]
    public interface IRawElementProviderSimple
    {
        ProviderOptions ProviderOptions { get; }

        [return: MarshalAs(UnmanagedType.IUnknown)]
        object GetPatternProvider(UIAutomationPatternId patternId);

        object GetPropertyValue(int propertyId);

        IRawElementProviderSimple HostRawElementProvider { get; }
    }

    public static class UIAutomationCore
    {
        public const string UIAUTOMATIONCORE_MODULE_NAME = "UIAutomationCore.dll";

        [DllImport(UIAUTOMATIONCORE_MODULE_NAME, EntryPoint = "UiaClientsAreListening", CharSet = CharSet.Unicode)]
        private static extern bool UiaClientsAreListening();

        [DllImport(UIAUTOMATIONCORE_MODULE_NAME, EntryPoint = "UiaHostProviderFromHwnd", CharSet = CharSet.Unicode)]
        public static extern int UiaHostProviderFromHwnd(HWND hwnd, [MarshalAs(UnmanagedType.Interface)] out IRawElementProviderSimple provider);

        [DllImport(UIAUTOMATIONCORE_MODULE_NAME, EntryPoint = "UiaRaiseAsyncContentLoadedEvent", CharSet = CharSet.Unicode)]
        private static extern int UiaRaiseAsyncContentLoadedEvent(IRawElementProviderSimple provider, AsyncContentLoadedState asyncContentLoadedState, double PercentComplete);

        [DllImport(UIAUTOMATIONCORE_MODULE_NAME, EntryPoint = "UiaRaiseAutomationEvent", CharSet = CharSet.Unicode)]
        public static extern int UiaRaiseAutomationEvent(IRawElementProviderSimple el, int eventId);

        [DllImport(UIAUTOMATIONCORE_MODULE_NAME, EntryPoint = "UiaRaiseAutomationPropertyChangedEvent", CharSet = CharSet.Unicode)]
        public static extern int UiaRaiseAutomationPropertyChangedEvent(IRawElementProviderSimple el, int propertyId, object oldValue, object newValue);

        [DllImport(UIAUTOMATIONCORE_MODULE_NAME, EntryPoint = "UiaRaiseStructureChangedEvent", CharSet = CharSet.Unicode)]
        private static extern int UiaRaiseStructureChangedEvent(IRawElementProviderSimple provider, StructureChangeType structureChangeType, int[] runtimeId, int runtimeIdLen);

        [DllImport(UIAUTOMATIONCORE_MODULE_NAME, EntryPoint = "UiaReturnRawElementProvider", CharSet = CharSet.Unicode)]
        public static extern IntPtr UiaReturnRawElementProvider(HWND hwnd, IntPtr wParam, IntPtr lParam, IRawElementProviderSimple el);
    }
     */
}
